home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / libscsi1.zoo / LibScsi-0.01 / load.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-14  |  794 b   |  42 lines

  1. /*
  2.  * load.c - Copyright Steve Woodford, August 1993.
  3.  *
  4.  * Send 'load/unload' command to SCSI target.
  5.  */
  6.  
  7. #include <sys/types.h>
  8. #include <sys/scsi.h>
  9. #include "libscsi.h"
  10.  
  11.  
  12. PUBLIC  short
  13. Scsi_Load_Unload(u_char id, u_char flg)
  14. {
  15.     Scsi_Cmd    sc;
  16.     short       to;
  17.  
  18.     if ( id & 0xc0 )
  19.         return(-1);
  20.  
  21.     switch ( flg )
  22.     {
  23.       case 0:   to = T_Unload(id);
  24.                 break;
  25.       case 1:   to = T_Load(id);
  26.                 break;
  27.       default:  to = T_Retension(id);
  28.                 break;
  29.     }
  30.  
  31.     (void) _Scsi_Timeout( to );
  32.  
  33.     sc.sc_command = CMD(id, SZ_CMD_LOAD_UNLOAD);
  34.     sc.sc_z[0]    = LUN(id, 0);
  35.     sc.sc_z[1]    = 0;
  36.     sc.sc_z[2]    = 0;
  37.     sc.sc_z[3]    = flg & 0x03;
  38.     sc.sc_link    = 0;
  39.  
  40.     return ( _Scsi_Command( DMA_READ, &sc, 0L, 0 ) );
  41. }
  42.